package com.hqully.smartfumehood.common.config;

import com.hqully.smartfumehood.udp.UDPServer;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
/**
 * <p>
 * UDP服务配置类
 * </p>
 * @author liulingyu
 * @date 2022-05-07 19:26
 * @version 1.0
 */
@Data
@Component
@ConfigurationProperties(prefix = "udp")
public class UDPServerConfig {

    private int port;

    @Bean
    public UDPServer UDPServer(){
        UDPServer udpServer = new UDPServer();
        udpServer.bind(port);
        return udpServer;
    }
}
